home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
selfile.zip
/
SELFILE.DOC
< prev
next >
Wrap
Text File
|
1993-01-04
|
8KB
|
191 lines
Selfile.Pas - Copyright (c) 1988 - Repstad Computer Consultants
RFD #1, Box 3720
Sheldon, VT 05483
(802) 933-5133 (voice)
(802) 933-2417 (Data - The Black Creek BBS)
Selfile is a Turbo Pascal V4.0 Unit that you can include in programs you
write. It is shareware...this means that if you use it you are expected
to make a contribution, $10.00 is requested. Those who use it and do
not make a contribution will suffer the consequences in the next dimension.
To use selfile in your program include the clause:
"Uses SelFile;"
in your program, selfile should be declared before any "Uses" references
to DOS or CRT, (i.e. USES SelFile,Dos,Crt;);
There are two basic functions defined in the selfile TPU. The first is
Sel_File itself. It will open a window and display the contents of the
file directory specified by PATH within that window. The user can then
use the arrow keys and PgUp/PgDn keys to highlight the desired file.
Added in version 3.0: Selfile now allows the user to select a file by
typing characters. Characters entered by the user define a search string
that the program uses to match against the filenames. The first file
in the list that matches the search string will be highlighted. This
means that the user can jump to a file of his/her choice by typing
the letters that begin the filename. In order to facilitate this
method of file selection Selfile now uses in insertion sort to build the
files linked list in alphabetical order. The search string the user
enters is displayed in the lower left corner of the window so he/she
will be able to see what they have typed. Selfile will not automatically
select a file this way, only highlight it, the user still has to
hit the return key to select the file.
Hitting the return key selects the file, hitting the escape key aborts the
file selection. Selfile returns an integer code indicating the action the
user took, return codes are;
-1 = No files found that match the search path.
0 = User hit the escape key to abort file selection.
1 = User selected a file from the list, filename returned
in the argument File_Name.
2 = User hit the F1 Key inidcating he wants to create a
New File (This is my convention, you can change this
if you like, you can also add more Function key
definitions and return codes).
Example:
Const
Title = 'Select A File';
Var
File_Name : String[12];
Path : String[3] = '*.*;
Attr : Integer = 0;
Begin
IRetVal := Sel_File(File_Name,Title,Path,Attr);
If (IRetVal = 1) Then
{ here we have a file name returned}
Else if (IRetVal = 2) Then
{ here user hit the F1 key indicating he wants to create
a new file}
Else if (IRetVal = -1) Then
{ no files found }
Else {IRetVal = 0}
{ here no file name was returned/selected, user hit esc key}
End.
Arguments to the Sel_File function are as follows:
File_Name : This should be a string declared as String[12], you must
also include the compiler directive {$V-} to turn off
strict string argument checking .
Title : This is a string to displayed in the upper left corner
of the boarder of the file display window.
(e.g. Title := 'Select A File';)
The length of the title string must be less than
the file selection window with. See description for
the procedure SetLim for more info on window widths.
Path : This is the dos path/file specifier used to search with.
(e.g. Path := 'C:\Data\*.Dat';)
Attr : This is the attribute of the files you wish to search
for, normally 0, see the TPC 4.0 manual reference for
the FindFirst function for more info.
(e.g. Attr := 0;)
Procedure SetLim allows you to define the position and size of the file
selection window. The arguments to SetLim are as follows:
RowB : Screen absolute row to begin the window at.
ColB : Screen absolute col to begin the window at.
RowQ : Number of rows of file names to display (if you
select a boarder then the actual number of rows of
file names will be 2 less).
ColQ : Number of Columns of file names can be in the
range 1 to 5.
NOT the number of screen columns in the window.
Active: Video attribute for the highlighted filename.
Inactive: Video attribute for the window and non-highlighted filenames.
boarder: Boarder type 1 = double line, 2 = single line, 3 = +- chars,
0 = no boarder.
The file Test.Pas shows the use of Sel_File and SetLim. Play around with it
to see what really happens. Also since the source code is included here
you can see for yourself what is going on.
As with any program there may be bugs, etc. if you find a bug please report it,
preferably on my BBS, or on the CIS BPROGA forum. Also report any errors in
the documentation...etc...
If you have any suggestions let me know.
Even if you don't want to contribute, and you want to use it, please
register, I'd like to get an idea of how many people are using the thing and
wether or not I should spend more time on it and other modules.
And now a message from our sponsors:
+-----------------------------------------------------------+
| |
| The Black Creek BBS |
| |
| (802) 933-2417 |
| |
| 300/1200/2400 Baud 24hrs/7days a week |
| |
| 40Megs On-Line |
| |
| Home of PC-Gammon - The best backgammon game around! |
| |
| Call Today... We're waiting to hear from you... |
| |
+-----------------------------------------------------------+
Sel_File Registration Form
Name:
--------------------------------------------------
Address:
--------------------------------------------------
City:
--------------------------------------------------
State: Zip:
------- --------------------
Phone:
--------------------------------------------------
Donation:
---------------------------------------------------
Thank you for your registration and (hopefully) your donation.
You will be contacted with information of future releases products.
Mail this form to:
Repstad Computer Consultants
RFD #1, Box 3720
Sheldon, VT 05483